
import arcpy, string, os
from arcpy import env
from arcpy.mapping import *
inWS = r"L:\zeshengcai\serviceStandards"
arcpy.env.workspace = inWS
cur = arcpy.SearchCursor("Export_Output.dbf")
mxd = MapDocument(inWS + "\\Route 2 Service Standards.mxd")
tElements = ListLayoutElements(mxd, "TEXT_ELEMENT")
RouteNum = 3
RidersAvgW = ""
PassPerRev = ""
AveragePas = ""
AverageP_1 = ""
FareboxRec = ""
AverageRec = ""
RecoveryDi = ""
WeekdayHou = ""
FullWeekOp = ""
RouteReven = ""
CostPerPas = ""
AvgCostPer = ""
CostPerP_1 = ""
for row in cur:
    if RouteNum == row.Route:
        RidersAvgW = row.RidersAvgW
        print RidersAvgW
        PassPerRev = row.PassPerRev
        print PassPerRev
        AveragePas = str(row.AveragePas) + " Avg."
        print AveragePas
        AverageP_1 = row.AverageP_1
        print AverageP_1
        FareboxRec = row.FareboxRec
        print FareboxRec
        AverageRec = str(row.AverageRec) + " Avg."
        print AverageRec
        RecoveryDi = row.RecoveryDi
        print RecoveryDi
        WeekdayHou = row.WeekdayHou
        print WeekdayHou
        FullWeekOp = row.FullWeekOp
        print FullWeekOp
        RouteReven = row.RouteReven
        print RouteReven
        CostPerPas = row.CostPerPas
        print CostPerPas
        AvgCostPer = "$"+str(row.AvgCostPer) + " Avg."
        print AvgCostPer
        CostPerP_1 = row.CostPerP_1
        print CostPerP_1
        for tElement in tElements:
            if tElement.name == "RidersAvgW":
                tElement.text = RidersAvgW
            if tElement.name == "PassPerRev":
                tElement.text = PassPerRev
            if tElement.name == "AveragePas":
                tElement.text = AveragePas
            if tElement.name == "AverageP_1":
                tElement.text = AverageP_1
            if tElement.name == "AverageRec":
                tElement.text = AverageRec
            if tElement.name == "RecoveryDi":
                tElement.text = RecoveryDi
            if tElement.name == "WeekdayHou":
                tElement.text = WeekdayHou
            if tElement.name == "FullWeekOp":
                tElement.text = FullWeekOp
            if tElement.name == "RouteReven":
                tElement.text = RouteReven
            if tElement.name == "CostPerPas":
                tElement.text = CostPerPas
            if tElement.name == "AvgCostPer":
                tElement.text = AvgCostPer
            if tElement.name == "CostPerP_1":
                tElement.text = CostPerP_1
mxd.save()
del cur
del tElements
del mxd


        
        
